package cn.study.zjan;

import android.app.Application;
import android.graphics.Typeface;

import com.norbsoft.typefacehelper.TypefaceCollection;
import com.norbsoft.typefacehelper.TypefaceHelper;

/**
 * Created by Administrator on 2015/5/22 0022.
 */
public class AppContext extends Application {

    private TypefaceCollection mUbuntuTypeface;//Ubuntu字体

    @Override
    public void onCreate() {
        super.onCreate();


        initTypeFace();

    }

    protected void initTypeFace() {

        // Initialize Ubuntu typeface
        mUbuntuTypeface = new TypefaceCollection.Builder()
                .set(Typeface.NORMAL, Typeface.createFromAsset(getAssets(),
                        "fonts/ubuntu/Ubuntu-R.ttf"))
                .set(Typeface.BOLD, Typeface.createFromAsset(getAssets(),
                        "fonts/ubuntu/Ubuntu-B.ttf"))
                .set(Typeface.ITALIC, Typeface.createFromAsset(getAssets(),
                        "fonts/ubuntu/Ubuntu-RI.ttf"))
                .set(Typeface.BOLD_ITALIC, Typeface.createFromAsset(getAssets(),
                        "fonts/ubuntu/Ubuntu-BI.ttf"))
                .create();

        // Load helper with default custom typeface (single custom typeface)
        TypefaceHelper.init(mUbuntuTypeface);
    }

    /** Getter for Ubuntu typeface */
    public TypefaceCollection getUbuntuTypeface() {
        return mUbuntuTypeface;
    }
}
